package com.etb.wisdom.eframe.framework.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import com.etb.core.utils.JsonUtil;
import com.etb.web.action.ETBAction;
import com.etb.web.utils.WebUtil;
import com.etb.wisdom.eframe.framework.service.AppMenuService;
import com.etb.wisdom.eframe.model.AppMenu;

@Action("menu")
@Namespace("/eframe/framework/menu")
public class AppMenuAction extends ETBAction<AppMenu> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2341826674410242154L;

	@Autowired
	public AppMenuService menuService;
	
	@Override
	public void save() {
		menuService.save(dataObject);
	}
	
	public void getTreedata() {
		String id = request.getParameter("id");
		String nodeType = request.getParameter("nodeType");
		WebUtil.render(JsonUtil.toJSONArray(menuService.getTreenode(id, nodeType)).toString());
	}
	
	public void test() {
		System.out.println(id);
	}
	
}